home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1991 …esperately Seeking Seven / Desperately Seeking Seven.2mg / Dev.CD.8 / Essentials / Tools / DTS.Samples / SC02BusyBox / BusyBox.p / UUtils.p < prev    next >
Encoding:
Text File  |  1990-05-25  |  2.0 KB  |  100 lines  |  [04] ASCII Text (0x0000)

  1. {**********************************************************************
  2. {*
  3. {* BusyBox uUtils -- Version 3.0  (interface)
  4. {*
  5. {* Copyright (c)
  6. {* Apple Computer, Inc. 1986-1989
  7. {* All Rights Reserved.
  8. {*
  9. {* Developer Technical Support Apple II Sample Code
  10. {*
  11. {* This file contains the interface to the code which implements
  12. {* various utility routines used by the busybox program.
  13. {*
  14. {**********************************************************************}
  15.  
  16. Unit uUtils;
  17.  
  18. INTERFACE
  19.  
  20. USES
  21.     types,
  22.     locator,
  23.     intMath;
  24.  
  25.  
  26. CONST
  27.     srcCopy =   $0000;
  28.  
  29. FUNCTION IntToString (i : Integer): STR255;
  30. FUNCTION LongToString (l : LongInt): STR255; { test }
  31. FUNCTION IsToolError: BOOLEAN;
  32. PROCEDURE INC(VAR anIndex : Integer);
  33. PROCEDURE Dec(VAR anIndex: Integer);
  34.  
  35. IMPLEMENTATION
  36.  
  37. {$R-}
  38.  
  39. FUNCTION IntToString (i : Integer): STR255;
  40. var
  41.     size,
  42.     count   : Integer;
  43.     num : longInt;
  44.     str : string[20];
  45. BEGIN
  46.     num := i;
  47.     size := 0;
  48.     Long2Dec(num, @str, 19, true);
  49.     FOR count := 1 to 19 DO
  50.     BEGIN
  51.     IF (str[count] = '-') OR ((str[count] >= '0') AND (str[count] <= '9')) THEN
  52.     BEGIN
  53.     size := size + 1;
  54.     IntToString[size] := str[count];
  55.     END;
  56.     END;
  57.     IntToString[0] := char(size);
  58. END;
  59.  
  60. FUNCTION LongToString (l : LongInt): STR255; { test }
  61. var
  62.     size,
  63.     count   : Integer;
  64.     num : longInt;
  65.     str : string[20];
  66. BEGIN
  67.     num := l;
  68.     size := 0;
  69.     Long2Dec(num, @str, 19, true);
  70.     FOR count := 1 to 19 DO
  71.     BEGIN
  72.     IF (str[count] = '-') OR ((str[count] >= '0') AND (str[count] <= '9')) THEN
  73.     BEGIN
  74.     size := size + 1;
  75.     LongToString[size] := str[count];
  76.     END;
  77.     END;
  78.     LongToString[0] := char(size);
  79. END;
  80.  
  81.  
  82. FUNCTION IsToolError: BOOLEAN;
  83. BEGIN
  84.     IsToolError := FALSE;
  85.     if ToolErrorNum <> 0 then
  86.     IsToolError := TRUE;
  87. END;
  88.  
  89. PROCEDURE INC(VAR anIndex : Integer); {increase integer param by 1}
  90. BEGIN
  91.     anIndex := anIndex + 1;
  92. END;
  93.  
  94. PROCEDURE Dec(VAR anIndex: Integer); {decrease integer param by 1}
  95. BEGIN
  96.     anIndex := anIndex - 1;
  97. END;
  98.  
  99. END.
  100.